#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

int readInt(){
	int x = 0, flg = 0;
	char ch = getchar();
	while(ch < '0' || ch > '9'){
		if(ch == '-')	flg = 1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9'){
		x = x * 10 + (ch ^ '0');
		ch = getchar();
	}
	if(flg)
		x = - x;
	return x;
}

int T, N, A[1000010];
int P[1000010], ano[1000010];

inline bool checkSide(int x, int l, int r){
	return x == l - 1 || x == r + 1;
}

char str[1000010];
bool getFrom(int x){
	int l = ano[x], r = ano[x];
	int p = 1;
	str[p] = (x == 1 ? 'L' : 'R');
	int L = 1, R = 2 * N;
	if(x == 1)	++ L;
	else	-- R;
	vector<char> backList(1, 'L');
	for(int t=2; t<=N; t++){
		if(L != l && checkSide(ano[L], l, r)){
			str[++p] = 'L';
			if(ano[L] == l - 1)
				-- l, backList.push_back('L');
			else
				++ r, backList.push_back('R');
			++ L;
		}
		else if(R != r && checkSide(ano[R], l, r)){
			str[++p] = 'R';
			if(ano[R] == l - 1)
				-- l, backList.push_back('L');
			else
				++ r, backList.push_back('R');
			-- R;
		}
		else
			return false;
	}
	for(int i=N-1; i+1; i--)
		str[++p] = backList[i];
	str[++p] = '\0';
	return true;
}

int main(){
	freopen("palin.in", "r", stdin);
	freopen("palin.out", "w", stdout);
	T = readInt();
	while(T--){
		N = readInt();
		for(int i=1; i<=2*N; i++)
			A[i] = readInt();
		for(int i=1; i<=N; i++)
			P[i] = 0;
		for(int i=1; i<=2*N; i++)
			P[A[i]] ^= i;
		for(int i=1; i<=2*N; i++)
			ano[i] = P[A[i]] ^ i;
		if(getFrom(1)){
			printf("%s\n", str+1);
			continue;
		}
		if(getFrom(2*N)){
			printf("%s\n", str+1);
			continue;
		}
		printf("-1\n");
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
